package com.stlm2.dems.dao.impl;

import org.springframework.stereotype.Repository;

import com.stlm2.dems.entity.GoodsRelateCategory;
import com.stlm2.dems.dao.GoodsRelateCategoryDao;
import com.stlm2.core.base.impl.BaseDaoImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository("goodsRelateCategoryDao")
public class GoodsRelateCategoryDaoImpl extends BaseDaoImpl<GoodsRelateCategory> implements GoodsRelateCategoryDao {


    @Override
    public List<GoodsRelateCategory> getByGoodsId(Integer goodsId) {
        return selectList("getByGoodsId",goodsId);
    }

    @Override
    public GoodsRelateCategory getByGoodsCategoryId(Integer goodsCategoryId) {
        return selectOne("getByGoodsCategoryId",goodsCategoryId);
    }

    @Override
    public List<GoodsRelateCategory> getByGoodsIdAndLevel(Integer goodsId,Integer goodsCategoryLevelValue) {
        Map<String,Object> map = new HashMap<String, Object>();
        map.put("goodsId",goodsId);
        map.put("goodsCategoryLevelValue",goodsCategoryLevelValue);
        return selectList("getByGoodsIdAndLevel",map);
    }

    @Override
    public GoodsRelateCategory getByGoodsIdAndCategory(Integer goodsId, Integer goodsCategoryId) {
        Map<String,Object> map = new HashMap<String, Object>();
        map.put("goodsId",goodsId);
        map.put("goodsCategoryId",goodsCategoryId);
        return selectOne("getByGoodsIdAndCategory",map);
    }

    @Override
    public List<GoodsRelateCategory> getByCategoryIdAndGoodsId(Integer goodsCategoryId, Integer goodsId) {
        Map<String,Object> map = new HashMap<String, Object>();
        map.put("goodsCategoryId",goodsCategoryId);
        map.put("goodsId",goodsId);
        return selectList("getByCategoryIdAndGoodsId",map);
    }
}